home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Catalog Service Access Module / DTS Sample CSAM / Src / DirParseCommon.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-24  |  1.5 KB  |  54 lines  |  [TEXT/KAHL]

  1. /*                                DirParseCommon.c                                */
  2. /*
  3.  * DirParseCommon.c
  4.  * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
  5.  *
  6.  * This is the "entrance" to the difficult parse routines. It places the parameter
  7.  * block into the request queue and, if the queue had been empty, calls the
  8.  * process procedure. If this is a synchronous request, DirParseCommon stalls
  9.  * here until the request completes.
  10.  */
  11. #include "DTSSampleCSAM.h"
  12.  
  13. void
  14. DirParseCommon(
  15.         register DTSSampleCSAMInfoPtr    infoPtr,
  16.         register DirParamBlockPtr        pb,
  17.         Boolean                            async
  18.     )
  19. {
  20.         short                    saveSR;
  21.         
  22.         STATUS = ioBusy;
  23.         /*
  24.          * If the queue is empty, just call the command processor. Otherwise, add
  25.          * this request to the queue of things that need processing. Locking out
  26.          * interrupts prevents a statistically-unlikely race condition where the
  27.          * queue contents change out from under us.
  28.          */
  29. /***/    saveSR = DisableInterrupts();
  30. /***/    if (INFO.requestQueueHdr.qHead == NULL) {
  31. /***/        EnableInterrupts(saveSR);
  32.             ProcessPDCommands(infoPtr, pb, async);
  33.         }
  34. /***/    else {
  35. /***/        Enqueue((QElemPtr) pb, &INFO.requestQueueHdr);
  36. /***/        EnableInterrupts(saveSR);
  37.         }
  38.         if (async == FALSE) {
  39.             /*
  40.              * Synchronous request. Stall until the request completes. On a real
  41.              * operating system, we would call a real "reschedule" routine.
  42.              */
  43.             LogStatus('DiPC', STATUS, "\pSynchronous stall");
  44.             while (STATUS == ioBusy)
  45.                 ;
  46.         }
  47.         LogStatus('DiPC', STATUS, "\pDirParseCommon exit status");
  48. }
  49.  
  50.             
  51.                 
  52.  
  53.  
  54.